<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>15_正则表达式-字面量</title>
    </head>
    <body>
        <script>
            // (1)创建一个正则表达式，检查一个字符串中是否有a或b
            var reg = /a|b/;
            console.log(reg.test('fjsldjfldsf'));
            console.log(reg.test('fjsaldjfldsf'));
            console.log(reg.test('fjsbldjfldsf'));

            // (2)创建一个正则表达式,检查一个字符串中是否有字母
            // var reg = /a|b|c|d|e|f|g/;
            // var reg = /[abcdefghijklmnopqrstuvwxyz]/;
            var reg = /[a-z]/;
            console.log(reg.test('12323213'));
            console.log(reg.test('12323a213'));


            var reg = /[0-9]/;
            console.log(reg.test('dfajfld'));
            console.log(reg.test('dfaj1fld'));

            var reg = /[A-Z]/;
            console.log(reg.test('FJSLFJfdsf'));

            var reg = /[A-z]/;
            console.log(reg.test('fdsjflAJFLDJLKF'));

            // (3)检查一个字符串中是否含有 abc 或 adc 或 aec

            var reg = /a[bde]c/;
            console.log(reg.test('abc'));
            

        </script>
    </body>
</html>